package com.project.springboot.controller;

import com.gitee.yongzhuzl.commonutil.util.result.ResponseResult;
import com.project.springboot.service.transaction.TransactionService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * description: 测试事务Controller
 * @author 朱正磊
 * @date 2023-06-14 21:45:35
 */
@Slf4j
@RestController
public class TransactionController {

    @Resource
    private TransactionService transactionService;

    /**
     * description: 测试一
     * @author 朱正磊
     * @date 2023-06-14 21:47:46
     * @return 返回响应对象
     */
    @GetMapping("/test1")
    public ResponseResult<Void> test1(String pName, String userName) {
        transactionService.test1(pName, userName);
        log.info("请求test1成功！");
        return ResponseResult.buildSuccess();
    }

    /**
     * description: 测试二
     * @author 朱正磊
     * @date 2023-06-15 16:03:58
     * @return 返回响应对象
     */
    @PostMapping("/test2")
    public ResponseResult<Void> test2(String pName, String userName) {
        transactionService.test2(pName, userName);
        log.info("请求test2成功！");
        return ResponseResult.buildSuccess();
    }

    /**
     * description: 测试三
     * @author 朱正磊
     * @date 2023-06-15 16:03:58
     * @return 返回响应对象
     */
    @PostMapping("/test3")
    public ResponseResult<Void> test3(String pName, String userName) {
        transactionService.test3(pName, userName);
        log.info("请求test3成功！");
        return ResponseResult.buildSuccess();
    }

    /**
     * description: 测试四
     * @author 朱正磊
     * @date 2023-06-15 16:03:58
     * @return 返回响应对象
     */
    @PostMapping("/test4")
    public ResponseResult<Void> test4(String pName, String userName) {
        transactionService.test4(pName, userName);
        log.info("请求test4成功！");
        return ResponseResult.buildSuccess();
    }

}
